/*    */ package com.zimbra.cs.service.mail;
/*    */ 
/*    */ import com.zimbra.common.service.ServiceException;
/*    */ import com.zimbra.common.soap.Element;
/*    */ import com.zimbra.common.soap.MailConstants;
/*    */ import com.zimbra.cs.mailbox.Mailbox;
/*    */ import com.zimbra.cs.mailbox.Note;
/*    */ import com.zimbra.cs.mailbox.Note.Rectangle;
/*    */ import com.zimbra.cs.mailbox.OperationContext;
/*    */ import com.zimbra.cs.service.util.ItemId;
/*    */ import com.zimbra.cs.service.util.ItemIdFormatter;
/*    */ import com.zimbra.soap.ZimbraSoapContext;
/*    */ import java.util.Map;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class CreateNote
/*    */   extends MailDocumentHandler
/*    */ {
/* 42 */   private static final String[] TARGET_FOLDER_PATH = { "note", "l" };
/* 43 */   private static final String[] RESPONSE_ITEM_PATH = new String[0];
/* 44 */   protected String[] getProxiedIdPath(Element request) { return TARGET_FOLDER_PATH; }
/* 45 */   protected boolean checkMountpointProxy(Element request) { return true; }
/* 46 */   protected String[] getResponseItemPath() { return RESPONSE_ITEM_PATH; }
/*    */   
/*    */   public Element handle(Element request, Map<String, Object> context) throws ServiceException {
/* 49 */     ZimbraSoapContext zsc = getZimbraSoapContext(context);
/* 50 */     Mailbox mbox = getRequestedMailbox(zsc);
/* 51 */     OperationContext octxt = getOperationContext(zsc, context);
/* 52 */     ItemIdFormatter ifmt = new ItemIdFormatter(zsc);
/*    */     
/* 54 */     Element t = request.getElement("note");
/* 55 */     ItemId iidFolder = new ItemId(t.getAttribute("l"), zsc);
/* 56 */     String content = t.getAttribute("content");
/* 57 */     byte color = (byte)(int)t.getAttributeLong("color", 0L);
/* 58 */     String strBounds = t.getAttribute("pos", null);
/* 59 */     Note.Rectangle bounds = new Note.Rectangle(strBounds);
/*    */     
/* 61 */     Note note = mbox.createNote(octxt, content, bounds, color, iidFolder.getId());
/*    */     
/* 63 */     Element response = zsc.createElement(MailConstants.CREATE_NOTE_RESPONSE);
/* 64 */     if (note != null)
/* 65 */       ToXML.encodeNote(response, ifmt, octxt, note);
/* 66 */     return response;
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/service/mail/CreateNote.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */